package com.gaofei.config;

import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;

import java.util.HashMap;

public class Tes
{
    public static void main(String[] args) {
//        HashMap<String, Object> map1 = new HashMap<>();
//        map1.put("code","956770f6356d925fe0d67475b771f632a7174bc02d314bca2e63ea39b1927533");
//        map1.put("grant_type","authorization_code");
//        map1.put("client_id","7fb8c7c5f6061a82c2c43f300657185a20a3b49faad7e39cfa1403505628e3cb");
//        map1.put("redirect_uri", "http://127.0.0.1:8080/callback");
//        map1.put("client_secret", "6ca6b97d81855f86b04d87eccf2045457ee3d784c389f7169e7eb56c58bc2750");
//        String post = HttpUtil.post("https://gitee.com/oauth/token", map1);
//        System.out.println(post);
        String tokenStr = "{\"access_token\":\"14462fb34ae9c5a164945f3c9c5669a2\",\"token_type\":\"bearer\",\"expires_in\":86400,\"refresh_token\":\"4c6191f3b3801996747b92a6d2eb6aab265e9abc3b845e5944f3dbecf29240ad\",\"scope\":\"user_info projects pull_requests emails\",\"created_at\":1693012244}";
        JSONObject entries = JSONUtil.parseObj(tokenStr);
        entries.forEach((k,v)->{
            System.out.println(k+":"+v);
        });
        String access_token = (String) entries.get("access_token");


    }
}
